import { useNavigate, useParams, useSearchParams } from "react-router-dom";

function withRoute(WrapComponent)
{
    return props => 
    {
        const navigate = useNavigate();
        const params = useParams();
        const [seatchParams] = useSearchParams();
        const query = Object.fromEntries(seatchParams);
        const route = { navigate,params,query};
        return <WrapComponent {...props} route={route}/>
    }
}

export default withRoute;